package com.maybach.core.flow.preparer;

import com.maybach.workflow.common.api.IContextPreparer;
import com.maybach.workflow.common.api.WorkFlowContext;
import com.maybach.workflow.common.api.enums.WFContextKeyEnum;
import com.maybach.workflow.common.model.FlowApplyDO;
import com.maybach.workflow.core.manager.FlowApplyManager;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by houenxun on 16/1/22.
 * 简单申请流程信息准备
 */
public class SimpleFlowPreparer implements IContextPreparer {
    @Autowired
    FlowApplyManager flowApplyManager;
    @Override
    public WorkFlowContext fillContext(WorkFlowContext context) {
        FlowApplyDO flowApplyDO = flowApplyManager.selectByPrimaryKey(context.getBizId());
        context.getBizData().put(WFContextKeyEnum.flowApplyDO.name(), flowApplyDO);
        context.getBizData().put(WFContextKeyEnum.flowApplyContent.name(), flowApplyDO.getContentObject());
        return context;
    }
}
